#ifndef __MAP_LOAD_SLAM_A_H__
#define __MAP_LOAD_SLAM_A_H__

#include <ros/ros.h>
#include <ros/package.h>
#include <tf2/LinearMath/Quaternion.h>
#include <tf2/LinearMath/Matrix3x3.h>
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#include <tf2/utils.h>
#include <nav_msgs/OccupancyGrid.h>
#include <nav_msgs/MapMetaData.h>
#include <std_msgs/String.h>

#include <iostream>
#include <sstream>
#include <yaml-cpp/yaml.h>
#include <opencv2/opencv.hpp>
#include <common_modules/file_manager/file_manager.h>
using namespace std;
using namespace cv;

class MapLoadNode{
    public:
        MapLoadNode();
        ~MapLoadNode();

        // 获取地图列表并加载地图
        void getMapListAndLoad();
        // 获取地图元数据
        nav_msgs::MapMetaData MapMetaDataFromYaml(string map_yaml_file);
        // Euler(roll, pitch, yaw) -> tf2::Quaternion
        tf2::Quaternion Euler2TFQuaternion(double roll, double pitch, double yaw);
        // Euler(roll, pitch, yaw) -> geometry_msgs::Quaternion
        geometry_msgs::Quaternion Euler2GeometryQuaternion(double roll, double pitch, double yaw);
        // 读取Yaml文件
        YAML::Node ReadYamlFile(string file_path);
        // 加载地图
        void MapLoad(string map_name);

    private:
        ros::NodeHandle nh_;
        ros::Publisher mapPub_;
        ros::Publisher mapNamePub_;
        string mapsDir_;
};

#endif